import Vue from 'vue'
import {request} from "../util/api";
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
    state: {
		// 职业数组
		JobList: [],
		// 专业数据
		zhuanyeList: []
	},
    mutations: {
		// 获取职业专业目标数据
		getGlobalData(state){
			request({
				url: "/system/compassMajobMine/queryByUserType",
				method: "post",
				data: {
					mjUser: uni.getStorageSync(process.env.NODE_ENV + 'zbz_user').userId
				}
			}).then(res=>{
				let dataList = res.data
				state.JobList=[]
				state.zhuanyeList=[]
				for (let item of dataList) {
					// 目标职业数组
					if (item.mjType === "1") {
						state.JobList.push(item)
					} else {
						state.zhuanyeList.push(item)
					}
				}
			})
		}
	},
    actions: {}
})
export default store
